package com.binhthuan.catechist.client.data;

import com.binhthuan.catechist.shared.constant.Parameter;
import com.binhthuan.catechist.shared.constant.Service;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class FunctionDS extends AbstractDS {

    private static FunctionDS instance;

    private FunctionDS() {
        super(Service.FUNCTION);

        DataSourceIntegerField id = new DataSourceIntegerField(Parameter.ID);
        id.setPrimaryKey(true);
        id.setHidden(true);

        DataSourceTextField code = new DataSourceTextField(Parameter.CODE);
        DataSourceTextField name = new DataSourceTextField(Parameter.NAME);
        DataSourceIntegerField securityCode = new DataSourceIntegerField(Parameter.SECURITY_CODE);

        setFields(id, code, name, securityCode);
    }

    public static FunctionDS getInstance() {
        if (instance == null) {
            instance = new FunctionDS();
        }
        return instance;
    }
}
